package com.wx_shop.api.vo;

import org.apache.commons.lang.StringUtils;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.wx_shop.api.comm.ServiceCode;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class BaseRes<T> {

	private T data;

	private String message;
	private Integer status;

	private ServiceCode serviceCode;
	
	public void setServiceCode(ServiceCode serviceCode) {
		this.serviceCode = serviceCode;
	}
	
	public String getMessage() {
		String _msg = null;
		if( null != serviceCode ) {
			if( StringUtils.isNotEmpty(message) ) {
				_msg = message + "|" + serviceCode.message;
			} else {
				_msg = serviceCode.message;
			}
		} else {
			_msg = message;
		}
		return _msg;
	}

	

	public Integer getStatus() {
		if( null != serviceCode ) {
			return serviceCode.status;
		}
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

}
